home *** CD-ROM | disk | FTP | other *** search
-
-
-
- GREP
-
-
-
- NAME
- grep - search a file for a pattern
-
- SYNOPSIS
- grep [ options ] expression [ files ]
-
- DESCRIPTION
- Commands of the grep family search the input files (standard
- input default) for lines matching a pattern. Normally, each
- line found is copied to the standard output. The following
- options are recognized:
-
- -x (Exact) only lines matched in their entirety are
- printed.
- -c Only a count of matching lines is printed.
- -m Do not ignore upper/lower case distinction during
- comparisons (default is ignore case).
- -l Only the names of files with matching lines are listed
- (once).
- -n Each line is preceded by its relative byte number in
- the file.
- -s The error messages produced for nonexistent or
- unreadable files are suppressed.
- -e expression
- Same as a simple expression argument, but useful when
- the expression begins with a "-".
- -f file
- The strings list is taken from the file.
- -h
- Printing of the file names is suppressed.
-
- In all cases, the file name is output if there is more than
- one input file. It is safest to enclose the entire
- expression argument in double quotes "...".
-
- You may include more than one file specification on the
- command line. For example
-
- grep -m test *.c *.h
-
- This will search all files in the default directory of the
- form *.c and *.h for all occurrences of the word "test".
-
- DIAGNOSTICS
- Exit status is 0 if any matches are found, 1 if none, 2 for
- syntax errors or inaccessible files (even if matches were
- found).
-
- BUGS
- Ideally grep would print the line number in which the string
- was found. Because the Boyer-Moore algorithm (which uses a
- skip pattern) is used this is not possible.
-